import requests

# 声明爬取的网站地址
url = "https://www.baidu.com/more/"

# 对地址发起请求  <Response [200]> 响应200 表示获取数据成功
response = requests.get(url)
# 一般情况下 使用text
# html = response.text
# 对的文件进行解码  有的网站编码时gbk，gbk-2321
# text/html; charset=utf-8
html = response.content.decode("utf-8")
print(html)

with open("./html/baidu.html", "w", encoding="utf8") as f:
    f.write(html)
